package org.linlinjava.litemall.db.service;

import org.linlinjava.litemall.db.dao.LitemallBrandAppendMapper;
import org.linlinjava.litemall.db.domain.LitemallBrandAppend;
import org.linlinjava.litemall.db.domain.LitemallBrandAppendExample;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;


@Service
public class LitemallBrandAppendService {

    @Resource
    private LitemallBrandAppendMapper brandAppendMapper;
    //增
    public void addBrandAppend(LitemallBrandAppend brandAppend){
       brandAppendMapper.insertSelective(brandAppend);
    }
    //删
    public void delBrandAppend(Integer id){
        brandAppendMapper.deleteByPrimaryKey(id);
    }
    //改
    public void ipdateBrandAppend(LitemallBrandAppend brandAppend){
        brandAppendMapper.updateByPrimaryKeySelective(brandAppend);
    }
    //查:所有
    public List<LitemallBrandAppend> allBrandAppends(){
        LitemallBrandAppendExample example = new LitemallBrandAppendExample();
        LitemallBrandAppendExample.Criteria criteria = example.createCriteria();
        criteria.andAppendTypeEqualTo("credential").andPicDescripEqualTo("公司证书");
        return brandAppendMapper.selectByExample(example);
    }
    //查:本公司所有   公司证书
    public List<LitemallBrandAppend> credentialBybrandId(Integer brandId){
        LitemallBrandAppendExample example = new LitemallBrandAppendExample();
        LitemallBrandAppendExample.Criteria criteria = example.createCriteria();
        if (null==brandId &&"".equals(brandId)){
            return null;
        }
        criteria.andBrandIdEqualTo(brandId).andAppendTypeEqualTo("credential").andPicDescripEqualTo("公司证书");
        return brandAppendMapper.selectByExample(example);
    }


}
